const margin={top:20, right:20, bottom:20, left:20}

const div=d3.select('body').append('div').attr('class','scrollDiv')
const ySvg=d3.select('.scrollDiv').append('svg').attr('width',1000).attr('height',2000)
const svg=d3.select('body').append('svg').attr('width',1000).attr('height',120)

const radsvg = d3.select("body")
            .append("svg")
            .attr('id','radr')
            .attr("width", svgWidth)
            .attr("height", svgHeight)


const selector=d3.select('body')
                .append('select')
                .attr('name','selector')
                .attr('id','selector')

d3.csv('../data/data.csv').then(data=>{
    data=data.map(item=>{
        return {
            team: item.Team,
            player: item.Player,
            KDA: +item.KDA,
            participationRate: +item.participationRate,
            avgHelp: +item.avgHelp,
            avgKill: +item.avgKill,
            avgDie: +item.avgDie
        }
    })
    data=data.filter(item=>{
        return item.team!=''&&item.player!=''&&item.KDA!='0'
    })
    drawRadr(data,radsvg,selector)
    drawBar(data,ySvg,svg)
}).catch(err=>{
    console.log(err)
})


function getText(i){
    switch(i){
        case 0:
            return 'KDA';
        case 1:
            return '参团率';
        case 2:
            return '场均助攻';
        case 3:
            return '场均杀敌';
        case 4:
            return '场均死亡';
    }
}